﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using PX.ImageFile;

public partial class Admin_ImageFileMT : PX.ShowLayer.BaseView
{
	private ImageFileView clsImageFileView = new ImageFileView();

	public Admin_ImageFileMT()
		: base("idTotal")
	{
		clsView = clsImageFileView;
		clsView.Page = Page;

		AddTableColumn(new Tony.Structs.TableShowColumn("文件名", "Name"));
		AddTableColumn(new Tony.Structs.TableShowColumn("上传时间", "ShowDate", 100));

		lBtnEdit.Visible = false;
	}

	protected override void OnInit(EventArgs e)
	{
		base.OnInit(e);

		gvTable.RowDataBound += new GridViewRowEventHandler(gvTable_RowDataBound);
	}

	protected void Page_Load(object sender, EventArgs e)
	{

	}

	protected override void SetControlText()
	{
		base.SetControlText();

		lBtnShowAdd.Text = "上传";
	}

	void gvTable_RowDataBound(object sender, GridViewRowEventArgs e)
	{
		if (e.Row.RowIndex >= 0)
		{
			for (int i = 0; i < e.Row.Cells.Count; i++)
			{
				//if ((i != 0)  (i != (e.Row.Cells.Count - 1)))
				if ((i != 0) && (i != (e.Row.Cells.Count - 1)))
				{
					//LinkButton lBtnRead2 = new LinkButton();

					//lBtnRead2.Text = e.Row.Cells[i].Text;
					//lBtnRead2.CommandArgument = ((GridView)sender).DataKeys[e.Row.RowIndex].Value.ToString();
					//lBtnRead2.CommandName = lBtnRead.CommandName;
					//lBtnRead2.CssClass = lBtnRead.CssClass;
					e.Row.Cells[i].Controls.Clear();
					HyperLink aLink = new HyperLink();

					aLink.CssClass = "Read";
					aLink.Text = e.Row.Cells[i].Text;
					aLink.NavigateUrl = "../ShowImageContent.aspx?FileID=" + ((GridView)sender).DataKeys[e.Row.RowIndex].Value.ToString();
					aLink.Target = "_blank";

					e.Row.Cells[i].Controls.Add(aLink);
				}
			}
		}
	}
}
